home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 19
/
CU Amiga Magazine's Super CD-ROM 19 (1998)(EMAP Images)(GB)[!][issue 1998-02].iso
/
CUCD
/
Programming
/
LEDA
/
prog
/
dict
/
set.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-08-05
|
508b
|
45 lines
#include <LEDA/set.h>
//void print(set<string> S, string s)
void print(set<string>& S, string s)
{ cout << s;
forall(s,S) cout << s << " ";
newline;
}
main()
{
set<string> S, S1;
string s;
while (cin >> s)
{ if (s == "stop") break;
S.insert(s);
}
S1 = S;
print(S, "S = ");
print(S1,"S1 = ");
while (cin >> s)
if (S1.member(s))
{ cout << "delete " << s << "\n";
S1.del(s);
}
else cout << s << " not in S1 \n";
print(S, "S = ");
print(S1,"S1 = ");
return 0;
}